package teatime.core.exception;

import teatime.core.utils.BusinessLogger;

/**
 * 业务异常基类.
 * 
 * @author D.G.
 */
public abstract class BusinessException extends Exception {

	private static final long serialVersionUID = 7288870221672966186L;

	private String trigger = "";

	private String context = "";

	protected BusinessException(String trigger, String context, String message) {
		super(message);
		this.trigger = trigger;
		this.context = context;
		// 将错误写入日志
		BusinessLogger.getLogger().error(
				"[" + this.getMessage() + "]" + trigger + "@" + context);
	}

	public String getTrigger() {
		return trigger;
	}

	public String getContext() {
		return context;
	}
}
